#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N = 2e5 + 10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//

vector<int> numMovesStonesII(vector<int> &stones)
{
    vector<int> res(2);
    int n = stones.size();
    sort(stones.begin(), stones.end());
    int m = stones.back() - stones[0] - (n - 1); //空位置的个数=最大的数-最小的数-(n-1)占用的数,头或者尾不算所以n-1
    res[1] = m - min(stones[1] - stones[0] - 1, stones[n - 1] - stones[n - 2] - 1); //看第一段和 最后一段哪个更小,从而求出最大的情况

    //求最小情况,最后的情况一定是连续的n个石头排在一块
    //希望不动的位置尽可能多
    res[0] = n;
    for (int i = 0, j = 0; i < n; i ++ )
    {
        while (stones[i] - stones[j] + 1 > n) j ++ ;
        m = i - j + 1;

        int r;
        if (m == n - 1 && stones[i] - stones[j] == i - j) r = 2;
        else r = n - m;

        res[0] = min(res[0], r);
    }

    return res;
}

int main()
{
   close();
   vector<int> t={1,4,5};
   auto ans=numMovesStonesII(t);
   cout<<"min "<<ans[0]<<'\n';
   cout<<"max "<<ans[1]<<'\n';
    return 0;
}